Component({
    externalClasses: [ "custom-bar", "custom-box", "custom-form", "custom-label", "custom-text", "custom-input", "custom-label-icon" ],
    properties: {
        fixed: Boolean,
        top: {
            type: String,
            value: "0px"
        },
        placeholder: {
            type: String,
            value: "搜索"
        },
        mode: {
            type: String,
            value: "white-gray"
        },
        showCardInlet: Boolean
    },
    data: {
        keyword: "",
        inputShowed: !1
    },
    methods: {
        _onInputTyping: function(t) {
            var o = t.detail.value;
            this.setData({
                keyword: o
            });
        },
        _onClearInput: function() {
            this.setData({
                keyword: ""
            });
        },
        setVal: function(t) {
            this.setData({
                keyword: t
            }), this._onShowInput(), this._onConfirm();
        },
        toggle: function(t) {
            t ? this._onShowInput() : this._onHideInput();
        },
        _onShowInput: function() {
            var t = this.data.keyword;
            this.setData({
                inputShowed: !0
            }), this.triggerEvent("toggle", {
                inputShowed: !0,
                keyword: t
            }, {});
        },
        _onHideInput: function() {
            this._onClearInput(), this.triggerEvent("toggle", {
                inputShowed: !1,
                keyword: ""
            }, {}), this.hide();
        },
        _onBlur: function() {
            !this.data.keyword && this._onHideInput();
        },
        onFocus: function() {
            this._onShowInput();
        },
        hide: function() {
            this.setData({
                keyword: "",
                inputShowed: !1
            });
        },
        _onConfirm: function() {
            this.triggerEvent("confirm", {
                value: this.data.keyword.trim()
            }, {});
        },
        goCardcase: function() {
            wx.switchTab({
                url: "/pages/tabbar/contacts/contacts"
            });
        }
    }
});